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

Reading a CWL file and the writing it back does not give original file

Open
#564 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

## Expected Behavior
Reading a cwl file and the writing the result to another cwl file (in Python) should results in the same file.

## Actual Behavior

Reading:

```
#!/usr/bin/env cwltool

cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
inputs:
message:
type: string
inputBinding:
position: 1
outputs:
echoed:
type: stdout
```
gives when written
```
#!/usr/bin/env cwltool

cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
inputs:
- type: string
inputBinding:
position: 1
id: file:///home/atze/scriptcwl/bla/echo.cwl#message
outputs:
- type: File
id: file:///home/atze/scriptcwl/bla/echo.cwl#echoed
outputBinding:
glob: 7e5dc6415991bff4635bcb6a67b33c2ff7c3f627
id: file:///home/atze/scriptcwl/bla/echo.cwl
stdout: 7e5dc6415991bff4635bcb6a67b33c2ff7c3f627
```

## Workflow Code

```python
from cwltool.load_tool import fetch_document, validate_document
(document_loader, workflowobj, uri) = fetch_document("echo.cwl")
(document_loader, avsc_names, processobj, metadata, uri) = validate_document(document_loader, workflowobj, uri)
s = processobj
from ruamel import yaml
import codecs
with codecs.open("echo2.cwl", 'wb', encoding='utf-8') as yaml_file:
yaml_file.write(yaml.dump(s, Dumper=yaml.RoundTripDumper))
```

## Your Environment
* cwltool version: 1.0.20171107133715

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.