This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Failing to use $mixin to include "global" settings

(Duplication of https://github.com/common-workflow-language/common-workflow-language/pull/309)

I want to split out some off my settings to a central configuration file and decided to use the mixin keyword. I started out with this example: http://www.commonwl.org/v1.0/SchemaSalad.html#Mixin

workflow.yml:

cwlVersion: "v1.0"

class: Workflow

inputs:
  $mixin: settings.yml
  inpFile:
    type: File
...

settings.yml:

java6:
  type: string
  default: "/opt/java6/bin/java"
java8:
  type: string
  default: "/opt/java8/bin/java"

Running this through cwltool (v1.0.20161110155008) I get the following error:

Tool definition failed validation:
While checking field `inputs`
  While checking object `file:///DEEP_fhgfs/projects/karln/WGBS/161007.cwlPlayground/git/BS-seq-pipelines/CWL/pipelines/postMap/bisSNP-realignPipe.yml#$mixin`
    Field `type` contains undefined reference to `../settings.yml`, tried [u'file:///DEEP_fhgfs/projects/karln/WGBS/161007.cwlPlayground/git/BS-seq-pipelines/CWL/pipelines/postMap/bisSNP-realignPipe.yml#../settings.yml']

My question is two-fold:

  1. What am I doing wrong? I assume that I'm formatting the settings.yml file wrongly. (Including the curly brackets from the example renders me another error)
  2. Is there a better way to provide global settings for multiple tools?

(Edit: after trying to figure it out for a while this is as far as I got. I also found an issue on the CWL-github page referring to something similar)

common-workflow-language cwl

Thanks for the site. Very useful.

Both files validate, but the tool helped me what could be the problem. The $mixin line is an entry in the inputs array. This leads to that the content of the settings.yml file becomes a subarray instead of being mixed in with the other elements.

1 answer

Hello Karl,

  1. You don't appear to be doing anything wrong -- looks like you found a bug in the reference implementation!
  2. $mixin was designed to solve your use case, so there isn't a better way

We don't have any CWL conformance tests that use mixins, hence why the pull request https://github.com/common-workflow-language/common-workflow-language/pull/309 is open.

OK, after doing some things wrong I found pull request 309 and it confirmed that I was on the right track :) I'll wait for it to resolve. It would be nice to have, but I can work around it for now.

Log in to answer this question.