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

stdout and stderr don't get used in the main function

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

Description

If stdout or stderr get passed as values to `cwltool.main.main`, the expected behaviour doesn't happen e.g. in the following, in python 3:

```python
import cwltool.main
import io
stream = io.StringIO()
cwltool.main.main(["test.cwl", "test.yml"], stdout=stream, stderr=stream)
```

It is expected for nothing to be outputted to the console, however, the following is outputted:
```
INFO:cwltool: 1.0.20171107133715
INFO:cwltool:Resolved '...' to '...'
DEBUG:cwltool:[job test.cwl_5] initializing from ...
DEBUG:cwltool:[job test.cwl_5] {
"parameter": "test"
}
DEBUG:cwltool:[job test.cwl_5] path mappings is {}
DEBUG:cwltool:[job test.cwl_5] command line bindings is [
{
"position": [
-1000000,
0
],
"datum": "echo"
},
{
"position": [
1,
"parameter"
],
"datum": "test"
}
]
INFO:cwltool:[job test.cwl_5] /private/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpm2vomy4j$ echo \
test
test
INFO:cwltool:[job test.cwl_5] completed success
DEBUG:cwltool:[job test.cwl_5] {}
DEBUG:cwltool:[job test.cwl_5] Removing input staging directory /private/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpn9kjnhce
DEBUG:cwltool:[job test.cwl_5] Removing temporary directory /private/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmp4xzktq97
DEBUG:cwltool:Removing intermediate output directory /private/var/folders/5p/p6z8hhy174q_ctt3pn7mx5_c000h1t/T/tmpm2vomy4j
INFO:cwltool:Final process status is success
0
```

for the workflow:

```
cwlVersion: v1.0
inputs:
- id: parameter
type: string
inputBinding:
position: 1
outputs: []
class: CommandLineTool
baseCommand: echo
```

and inputs:

```
parameter: test
```

From what I've briefly looked at, the handler for `logging.getLogger("cwltool")` and https://github.com/common-workflow-language/cwltool/blob/f691bf1aa66f2836694716c9845731962147079b/cwltool/job.py#L500 needs to be writing to the parameterised stdout, though there may be other occasions where stdout or stderr is always written to.

## 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.