rabix / bunny

[Legacy] Executor for CWL workflows. Executes sbg:draft-2 and CWL 1.0
http://rabix.io
Apache License 2.0
74 stars 28 forks source link

Error, cannot cast String to Map for array of records as input #446

Open whlavina opened 5 years ago

whlavina commented 5 years ago

Using rabix-cli-1.0.5, Rabix fails on CWL that specifies complex inputs, such as an array of records. By comparison, Cromwell and the reference cwltool both succeed on the sample inputs.

An example error message is:

Execution failed for root. org.rabix.bindings.cwl.processor.CWLPortProcessorException:
org.rabix.bindings.cwl.processor.CWLPortProcessorException:
Error: java.lang.String cannot be cast to java.util.Map while processing value:
[{my_field=field_1}, {my_field=field_2}]

Both CWL examples below fail with this same sample input - test.yaml:

my_array:
    - my_field: field_1
    - my_field: field_2

Using inline JS - test-command-line.cwl

cwlVersion: v1.0 
class: CommandLineTool
requirements:
  - class: InlineJavascriptRequirement
baseCommand: echo
arguments: ["$(JSON.stringify(inputs))"]
inputs:
    my_array:
        type: 
            type: array
            items: 
                  type: record
                  name: my_record
                  fields:
                      my_field: string

outputs:
    my_output:
        type: stdout

Using ExpressionTool - test-expression.cwl

cwlVersion: v1.0 
class: ExpressionTool
requirements:
  - class: InlineJavascriptRequirement
expression: "$({'my_output':inputs})"
inputs:
    my_array:
        type: 
            type: array
            items: 
                  type: record
                  name: my_record
                  fields:
                      my_field: string

outputs:
    my_output:
        type: Any

P.S. I'm not sure if InlineJavascriptRequirement is needed for an ExpressionTool or whether the expression should work with a simple string value (rather than an interpolated value). The CWL specifications and tutorial don't give much details.