Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,12 +1113,6 @@ def main(

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

if args.print_deps and loadingContext.loader:
printdeps(
workflowobj, loadingContext.loader, stdout, args.relative_deps, uri
)
return 0

loadingContext, uri = resolve_and_validate_document(
loadingContext,
workflowobj,
Expand All @@ -1127,6 +1121,12 @@ def main(
skip_schemas=args.skip_schemas,
)

if args.print_deps and loadingContext.loader:
printdeps(
workflowobj, loadingContext.loader, stdout, args.relative_deps, uri
)
return 0

if loadingContext.loader is None:
raise Exception("Impossible code path.")
processobj, metadata = loadingContext.loader.resolve_ref(uri)
Expand Down
23 changes: 23 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,29 @@ def test_scandeps_defaults_with_secondaryfiles() -> None:
].endswith(os.path.join("tests", "wf", "indir1"))


def test_issue_1765_print_deps_with_workflows_having_namespace_location_steps() -> None:
"""Test for issue 1765.

An external workflow step passed the validation, but failed to print-deps.
"""
stream = StringIO()

main(
[
"--print-deps",
"--relative-deps=primary",
"--debug",
get_data(
"tests/wf/print_deps_with_workflows_having_namespace_location_steps.cwl"
),
],
stdout=stream,
)
assert json.loads(stream.getvalue())["secondaryFiles"][0]["secondaryFiles"][0][
"location"
].endswith("EDAM_1.18.owl")


def test_dedupe() -> None:
not_deduped = [
{"class": "File", "location": "file:///example/a"},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env cwl-runner
# From:
# - https://github.com/common-workflow-language/cwltool/issues/1765
# - https://github.com/pvanheus/lukasa/blob/99e827e0125cf07621253ae081199298adf7227b/protein_evidence_mapping.cwl
cwlVersion: v1.2
class: Workflow

inputs:
contigs_fasta:
label: "Genomic contigs (FASTA)"
type: File
format: edam:format_1929
outputs:
out:
type: File
outputSource:
samtools_index_contigs/sequences_with_index

steps:
samtools_index_contigs:
# This step is from an external file. print_deps failed here, with a validation
# error message, even though --validate passed.
run: bio-cwl-tools:samtools/samtools_faidx.cwl
in:
sequences: contigs_fasta
out:
- sequences_with_index
$namespaces:
edam: http://edamontology.org/
bio-cwl-tools: https://raw.githubusercontent.com/common-workflow-library/bio-cwl-tools/release/
$schemas:
- http://edamontology.org/EDAM_1.18.owl