common-workflow-language / cwltool

Common Workflow Language reference implementation
https://www.commonwl.org
Apache License 2.0
324 stars 225 forks source link

enable use inside Jupyter notebooks #221

Open mr-c opened 7 years ago

mr-c commented 7 years ago

Tricky due to Jupyter's IO not supporting fileno/subprocess:

import cwltool.factory
f = cwltool.factory.Factory()
echo = f.make("v1.0/v1.0/echo-tool.cwl")
out = echo(in="foo")
  File "/home/michael/src/jupyterenv/local/lib/python2.7/site-packages/cwltool/job.py", line 221, in run
    cwd=self.outdir)
  File "/usr/lib/python2.7/subprocess.py", line 703, in __init__
    errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)
  File "/usr/lib/python2.7/subprocess.py", line 1153, in _get_handles
    errwrite = stderr.fileno()
  File "/home/michael/src/jupyterenv/local/lib/python2.7/site-packages/ipykernel/iostream.py", line 307, in fileno
    raise UnsupportedOperation("IOStream has no fileno.")
UnsupportedOperation: IOStream has no fileno.
r4space commented 6 years ago

I see this and the linked issue are both closed - was the feature added or the effort disbanded?

(googling Jupyter and CWL pretty much only returns these)

tetron commented 6 years ago

Probably not fixed. If Jupyter sets up an environment where sys.stderr doesn't have a file descriptor, then the alternative is that Popen needs to use stderr=subprocess.PIPE and creates a thread to read from the pipe and write to sys.stderr.