Skip to content

Step input with multiple sources adds extra value to array #411

Closed
@michael-kotliar

Description

@michael-kotliar

Expected Behavior

When using MultipleInputFeatureRequirement with merge_nested the input must be an array consisting of exactly one entry for each input link. It should be the same even if the type for the source is a list of two or more items.

Actual Behavior

If the source has a type set as a list of two or more items, it will be added to the result array exactly the same number of times as the length of its type list.

Workflow Code

cwlVersion: v1.0
class: Workflow

requirements:
  - class: SubworkflowFeatureRequirement
  - class: ScatterFeatureRequirement
  - class: StepInputExpressionRequirement
  - class: InlineJavascriptRequirement
  - class: MultipleInputFeatureRequirement

inputs:
  input_1:
    type: int
  input_2:
    type:
    - File
    - int

outputs:
  resut:
    type: int
    outputSource: echo/result

steps:
  echo:
    run: echo.cwl
    in:
      data:
        source: [input_1, input_2]
        valueFrom: |
          ${
              return self[0] + self[1];
          }
    out: [result]

Short Traceback

"file:///Users/kot4or/workspaces/cwl_ws/cwl_sandbox/multiple_input_source/workflow.cwl#echo/data": [
        1, 
        2, 
        2
    ]
}

Full Traceback

cwltool --debug workflow.cwl job.yml 
/usr/local/bin/cwltool 1.0.20170525215327
Resolved 'workflow.cwl' to 'file:///Users/kot4or/workspaces/cwl_ws/cwl_sandbox/multiple_input_source/workflow.cwl'
[workflow workflow.cwl] initialized from file:///Users/kot4or/workspaces/cwl_ws/cwl_sandbox/multiple_input_source/workflow.cwl
[workflow workflow.cwl] start
[workflow workflow.cwl] starting step echo
[job step echo] job input {
    "file:///Users/kot4or/workspaces/cwl_ws/cwl_sandbox/multiple_input_source/workflow.cwl#echo/data": [
        1, 
        2, 
        2
    ]
}
[job step echo] evaluated job input to {
    "file:///Users/kot4or/workspaces/cwl_ws/cwl_sandbox/multiple_input_source/workflow.cwl#echo/data": 3
}
[step echo] start
[job echo] initializing from file:///Users/kot4or/workspaces/cwl_ws/cwl_sandbox/multiple_input_source/echo.cwl as part of step echo
[job echo] {
    "data": 3
}
[job echo] path mappings is {}
[job echo] command line bindings is [
    {
        "position": [
            -1000000, 
            0
        ], 
        "datum": "echo"
    }, 
    {
        "position": [
            1, 
            "data"
        ], 
        "datum": 3
    }
]
[job echo] /var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpzDqvrt$ docker \
    run \
    -i \
    --volume=/private/var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpzDqvrt:/private/var/spool/cwl:rw \
    --volume=/private/var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpnYvOeu:/tmp:rw \
    --workdir=/private/var/spool/cwl \
    --read-only=true \
    --log-driver=none \
    --user=501 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/private/var/spool/cwl \
    ubuntu \
    echo \
    3 > /var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpzDqvrt/output.txt
[job echo] completed success
[job echo] {
    "result": 3
}
[step echo] produced output {
    "file:///Users/kot4or/workspaces/cwl_ws/cwl_sandbox/multiple_input_source/workflow.cwl#echo/result": 3
}
[step echo] completed success
[workflow workflow.cwl] completed success
[job echo] Removing input staging directory /var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmp1Q0eyL
[job echo] Removing temporary directory /var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpnYvOeu
Removing intermediate output directory /var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmp2OqTZa
{
    "resut": 3
}
Final process status is success

Link to reproduce test

https://github.com/michael-kotliar/cwl_sandbox/tree/master/multiple_input_source

Your Environment

  • cwltool version: 1.0.20170525215327

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