common-workflow-language / common-workflow-language/cwltool

Packing Error: relative path to tools are falsely handled as absolute

Open
#1,240 1 comment 0 reactions 1 assignee Claimed by @tetron View on GitHub
bug
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

## Expected Behavior
https://raw.githubusercontent.com/CompEpigen/ATACseq_workflows/1.2.0/CWL/workflows/ATACseq.cwl succeeds validation:

`cwltool --validate https://raw.githubusercontent.com/CompEpigen/ATACseq_workflows/1.2.0/CWL/workflows/ATACseq.cwl`

Therefore, packing should work without problems.

## Actual Behavior
`cwltool --pack --debug https://raw.githubusercontent.com/CompEpigen/ATACseq_workflows/1.2.0/CWL/workflows/ATACseq.cwl` fails.

## Workflow Code
```
https://raw.githubusercontent.com/CompEpigen/ATACseq_workflows/1.2.0/CWL/workflows/ATACseq.cwl
```

## Full Traceback
```pytb
INFO /usr/local/bin/cwltool 2.0.20200124134010
ERROR Tool definition failed validation:
[Errno 2] No such file or directory: '/mnt/c/Users/kerst/OneDrive/tools/bedtools_bedtobam.cwl'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/schema_salad/ref_resolver.py", line 198, in fetch_text
urllib.request.url2pathname(str(path)), encoding="utf-8"
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/c/Users/kerst/OneDrive/tools/bedtools_bedtobam.cwl'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/cwltool/main.py", line 916, in main
print_pack(loadingContext.loader, processobj, uri, metadata)
File "/usr/local/lib/python3.6/dist-packages/cwltool/main.py", line 563, in print_pack
packed = pack(document_loader, processobj, uri, metadata)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 151, in pack
find_run(processobj, loadref, runs)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 57, in find_run
find_run(s, loadref, runs)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 50, in find_run
find_run(s, loadref, runs)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 55, in find_run
find_run(loadref(None, d["run"]), loadref, runs)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 57, in find_run
find_run(s, loadref, runs)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 57, in find_run
find_run(s, loadref, runs)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 55, in find_run
find_run(loadref(None, d["run"]), loadref, runs)
File "/usr/local/lib/python3.6/dist-packages/cwltool/pack.py", line 145, in loadref
return document_loader.resolve_ref(uri, base_url=base)[0]
File "/usr/local/lib/python3.6/dist-packages/schema_salad/ref_resolver.py", line 735, in resolve_ref
doc = self.fetch(doc_url, inject_ids=(not mixin))
File "/usr/local/lib/python3.6/dist-packages/schema_salad/ref_resolver.py", line 1194, in fetch
text = self.fetch_text(url)
File "/usr/local/lib/python3.6/dist-packages/schema_salad/ref_resolver.py", line 204, in fetch_text
raise ValidationException(str(err)) from err
schema_salad.exceptions.ValidationException: [Errno 2] No such file or directory: '/mnt/c/Users/kerst/OneDrive/tools/bedtools_bedtobam.cwl'
```

If I understand the error correctly, the relative tool reference `../tools/bedtools_bedtobam.cwl` (see [here](https://github.com/CompEpigen/ATACseq_workflows/blob/master/CWL/workflow_modules/bed_to_coverage_track.cwl#L33)) gets converted into a non-existing absolute path `/mnt/c/Users/kerst/OneDrive/tools/bedtools_bedtobam.cwl` (with `/mnt/c/Users/kerst/OneDrive/` being the parent of my working directory).

Of note, `../tools/bedtools_bedtobam.cwl` is referenced in a [sub-workflow](https://github.com/CompEpigen/ATACseq_workflows/blob/master/CWL/workflow_modules/bed_to_coverage_track.cwl) which is in another directory than the [main workflow](https://github.com/CompEpigen/ATACseq_workflows/blob/master/CWL/workflows/ATACseq.cwl#L209). Maybe, this has something to do with the error.

## Your Environment
* cwltool version: 2.0.20200124134010 (from current master branch)

With the older version 1.0.20180809224403 the workflow packs as expected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.