Skip to content

Commit be418e9

Browse files
committed
Load schemas before calling print_deps
1 parent 67a1808 commit be418e9

File tree

3 files changed

+57
-6
lines changed

3 files changed

+57
-6
lines changed

cwltool/main.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1113,12 +1113,6 @@ def main(
11131113

11141114
loadingContext, workflowobj, uri = fetch_document(uri, loadingContext)
11151115

1116-
if args.print_deps and loadingContext.loader:
1117-
printdeps(
1118-
workflowobj, loadingContext.loader, stdout, args.relative_deps, uri
1119-
)
1120-
return 0
1121-
11221116
loadingContext, uri = resolve_and_validate_document(
11231117
loadingContext,
11241118
workflowobj,
@@ -1127,6 +1121,12 @@ def main(
11271121
skip_schemas=args.skip_schemas,
11281122
)
11291123

1124+
if args.print_deps and loadingContext.loader:
1125+
printdeps(
1126+
workflowobj, loadingContext.loader, stdout, args.relative_deps, uri
1127+
)
1128+
return 0
1129+
11301130
if loadingContext.loader is None:
11311131
raise Exception("Impossible code path.")
11321132
processobj, metadata = loadingContext.loader.resolve_ref(uri)

tests/test_examples.py

+19
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,25 @@ def test_scandeps_defaults_with_secondaryfiles() -> None:
586586
].endswith(os.path.join("tests", "wf", "indir1"))
587587

588588

589+
def test_issue_1765_print_deps_with_workflows_having_namespace_location_steps() -> None:
590+
stream = StringIO()
591+
592+
main(
593+
[
594+
"--print-deps",
595+
"--relative-deps=primary",
596+
"--debug",
597+
get_data(
598+
"tests/wf/print_deps_with_workflows_having_namespace_location_steps.cwl"
599+
),
600+
],
601+
stdout=stream,
602+
)
603+
assert json.loads(stream.getvalue())["secondaryFiles"][0]["secondaryFiles"][0][
604+
"location"
605+
].endswith("EDAM_1.18.owl")
606+
607+
589608
def test_dedupe() -> None:
590609
not_deduped = [
591610
{"class": "File", "location": "file:///example/a"},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env cwl-runner
2+
# From:
3+
# - https://github.com/common-workflow-language/cwltool/issues/1765
4+
# - https://github.com/pvanheus/lukasa/blob/99e827e0125cf07621253ae081199298adf7227b/protein_evidence_mapping.cwl
5+
cwlVersion: v1.2
6+
class: Workflow
7+
8+
inputs:
9+
contigs_fasta:
10+
label: "Genomic contigs (FASTA)"
11+
type: File
12+
format: edam:format_1929
13+
outputs:
14+
out:
15+
type: File
16+
outputSource:
17+
samtools_index_contigs/sequences_with_index
18+
19+
steps:
20+
samtools_index_contigs:
21+
# This step is from an external file. print_deps failed here, with a validation
22+
# error message, even though --validate passed.
23+
run: bio-cwl-tools:samtools/samtools_faidx.cwl
24+
in:
25+
sequences: contigs_fasta
26+
out:
27+
- sequences_with_index
28+
$namespaces:
29+
edam: http://edamontology.org/
30+
bio-cwl-tools: https://raw.githubusercontent.com/common-workflow-library/bio-cwl-tools/release/
31+
$schemas:
32+
- http://edamontology.org/EDAM_1.18.owl

0 commit comments

Comments
 (0)