Skip to content

We cannot pass an array of integers as a command line argument. #2034

@yamaken37

Description

@yamaken37

We cannot pass an array of integers as a command line argument.
Please let me know if there is a workaround for it.

Workflow Code

#!/usr/bin/env cwl-runner

class: CommandLineTool
cwlVersion: v1.1

requirements:
  InlineJavascriptRequirement: {}

baseCommand: echo

inputs:
  input_A:
    type: int[]

arguments:
  - valueFrom: ${ return inputs.input_A.join(" "); }
    position: 1

outputs: []

Expected Behavior

  • I expect it to work the same way it did when yaml was given to me.
$ cwltool test.cwl --input_A 0 --input_A 1
0 1
  • Here is the output given yaml
$ cwltool test.cwl test.yaml
INFO /bin/cwltool 3.1.20220224085855
INFO Resolved 'test.cwl' to 'file:///cwl-test/test.cwl'
INFO [job test.cwl] /tmp/ixzpdr_f$ echo \
    '0 1'
0 1
INFO [job test.cwl] completed success
{}
INFO Final process status is success
  • yaml
input_A:
  - 0
  - 1

Actual Behavior

$ cwltool test.cwl --input_A 1 --input_A 2
INFO /bin/cwltool 3.1.20220224085855
INFO Resolved 'test.cwl' to 'file:///cwl-test/test.cwl'
ERROR Workflow error, try again with --debug for more information:
Invalid job input record:
the `input_A` field is not valid because
  item is invalid because
    `'1'` is not int

Full Traceback

$ cwltool --debug test.cwl --input_A 1 --input_A 2

INFO /bin/cwltool 3.1.20220224085855
INFO Resolved 'test.cwl' to 'file:///cwl-test/test.cwl'
DEBUG Parsed job order from command line: {
    "id": "test.cwl",
    "input_A": [
        "1",
        "2"
    ]
}
ERROR Workflow error:
Invalid job input record:
the `input_A` field is not valid because
  item is invalid because
    `'1'` is not int
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cwltool/process.py", line 799, in _init_job
    validate_ex(
  File "/usr/lib/python3/dist-packages/schema_salad/validate.py", line 460, in validate_ex
    raise ValidationException("", None, errors, "*")
schema_salad.exceptions.ValidationException: the `input_A` field is not valid because
  item is invalid because
    `'1'` is not int

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

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cwltool/main.py", line 1343, in main
    (out, status) = real_executor(
  File "/usr/lib/python3/dist-packages/cwltool/executors.py", line 60, in __call__
    return self.execute(process, job_order_object, runtime_context, logger)
  File "/usr/lib/python3/dist-packages/cwltool/executors.py", line 143, in execute
    self.run_jobs(process, job_order_object, logger, runtime_context)
  File "/usr/lib/python3/dist-packages/cwltool/executors.py", line 228, in run_jobs
    for job in jobiter:
  File "/usr/lib/python3/dist-packages/cwltool/command_line_tool.py", line 990, in job
    builder = self._init_job(job_order, runtimeContext)
  File "/usr/lib/python3/dist-packages/cwltool/process.py", line 850, in _init_job
    raise WorkflowException("Invalid job input record:\n" + str(err)) from err
cwltool.errors.WorkflowException: Invalid job input record:
the `input_A` field is not valid because
  item is invalid because
    `'1'` is not int

Your Environment

  • cwltool version: 3.1.20220224085855

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions