Skip to content

Can't redirect stdin #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
serverhorror opened this issue Sep 20, 2016 · 2 comments
Closed

Can't redirect stdin #195

serverhorror opened this issue Sep 20, 2016 · 2 comments

Comments

@serverhorror
Copy link

Hi,

It seems impossible to redirect stdin so that a tool would read this. Am I using it wrong?

$ cwl-runner --debug tr.cwl params.yml
/home/marcherm/cwlSamples/bin/cwl-runner 1.0.20160919152321
[job tr.cwl] initializing from file:///home/marcherm/cwlSamples/tr.cwl
[job tr.cwl] {
    "message": "I am cleartext\nV nz pyrnegrkg\n"
}
[job tr.cwl] path mappings is {}
[job tr.cwl] command line bindings is [
    {
        "position": [
            -1000000,
            0
        ],
        "datum": "tr"
    },
    {
        "position": [
            0,
            0
        ],
        "datum": "[A-Za-z]"
    },
    {
        "position": [
            0,
            1
        ],
        "datum": "[N-ZA-Mn-za-m]"
    }
]
[job tr.cwl] /tmp/tmpcri0kw$ tr \
    [A-Za-z] \
    [N-ZA-Mn-za-m] < infile.tr
[job tr.cwl] initial work dir {
    "_:6f8a753d-6dde-4a4a-9c56-870b062cfa5f": [
        "_:6f8a753d-6dde-4a4a-9c56-870b062cfa5f",
        "/tmp/tmpcri0kw",
        "Directory"
    ],
    "_:dbdb06cc-41fa-41bb-a725-a4c75065d0ca": [
        "I am cleartext\nV nz pyrnegrkg\n",
        "/tmp/tmpcri0kw/infile.tr",
        "CreateFile"
    ]
}
Exception while running job
Traceback (most recent call last):
  File "/home/marcherm/cwlSamples/lib/python2.7/site-packages/cwltool/job.py", line 190, in run
    stdin = open(self.pathmapper.reversemap(self.stdin)[1], "rb")
TypeError: 'NoneType' object has no attribute '__getitem__'
[job tr.cwl] completed permanentFail
[job tr.cwl] {}
Final process status is permanentFail
[job tr.cwl] Removing input staging directory /tmp/tmpI9MKrF
[job tr.cwl] Removing temporary directory /tmp/tmpczQTwN
Workflow error, try again with --debug for more information:
  Process status is ['permanentFail']
Traceback (most recent call last):
  File "/home/marcherm/cwlSamples/lib/python2.7/site-packages/cwltool/main.py", line 672, in main
    **vars(args))
  File "/home/marcherm/cwlSamples/lib/python2.7/site-packages/cwltool/main.py", line 228, in single_job_executor
    raise WorkflowException(u"Process status is %s" % (final_status))
WorkflowException: Process status is ['permanentFail']
# tr.cwl
class: CommandLineTool
cwlVersion: v1.0
baseCommand: "tr"
arguments: ["[A-Za-z]", "[N-ZA-Mn-za-m]"]
#arguments: ["[A-Za-z]", "[N-ZA-Mn-za-m]", "infile.tr"]
#baseCommand: ["cat"]
#arguments: ["infile.tr"]

requirements:
  InitialWorkDirRequirement:
    listing:
      - entryname: infile.tr
        entry: $(inputs.message)

stdin: infile.tr
inputs:
  message:
    type: string
outputs: []
#outputs:
#  result:
#    type: stdout
# params.yml
message: |
  I am cleartext
  V nz pyrnegrkg

@tetron
Copy link
Member

tetron commented Sep 22, 2016

Hi @serverhorror this looks like a bug in the interaction between InitialWorkDirRequirement and stdin redirection. The code is assuming an input parameter, not a file created on the fly with InitialWorkDirRequirement.

tetron pushed a commit that referenced this issue Jul 23, 2017
@pmiddend
Copy link

pmiddend commented Jun 3, 2021

This might be at least partially solved. When I try to run a very similar example (generating a keywords.txt file from an input string), using a command that has a Docker requirement, I get "keywords.txt missing from pathmapper".
Apparently, keywords.txt is generated just fine, and a bind mount is created for Docker. However, it is then simply used as < keyword.txt to pipe it into stdin. Is that correct?

To be specific, this is my cwl file:

#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool
baseCommand: mtzutils
hints:
  DockerRequirement:
    dockerPull: pegi3s/ccp4
requirements:
  InitialWorkDirRequirement:
    listing:
      - entryname: keywords.txt
        entry: $(inputs.keywords)
inputs:
  input_mtz:
    type: File
    inputBinding:
      position: 0
      prefix: hklin
  output_mtz:
    type: string
    inputBinding:
      position: 1
      prefix: hklout
  keywords:
    type: string
stdin: keywords.txt
      

outputs:
  output_mtz:
    type: File
    outputBinding:
      glob: $(inputs.output_mtz)

@serverhorror serverhorror closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants