CWL Output Json


I am trying to work on a plugin that will output an array of strings. My goal is to also this plugin to feed into a scatter array. I think the best way to do this is via the cwl.output.json trick.

However, the documentation is lacking on why this works. I see that if I specify cwl.output.json, then I can not use any other output bindings other than the ones I place in the cwl.output.json object.

Is this file internal to how output objects are written out?

How can I add objects like stdout/stderr to this cwl.output.json? Do I have to add explicit instructions to write these logs to the plugin so I can capture stdout/stderr as part of an output object?

Would it be possible to update the documentation to explain more on how this trick works? I think it is useful but I am nervous about using this as it isn’t clear to me why it actually works.

1 Like

These are great questions. (same exact text in v1.1 and v1.2)

cwl.output.json should be formatted the same as a CWL output object (the JSON printed to stdout when you run cwltool).

There should be one top level dictionary: the keys are the output names and the values are the CWL values. For example, a CWL File should have the value {"class": "File", "path": "some/path.txt"} (or if you want to invent a file, then specify the basename and the contents right in the cwl.output.json file)

If you want to capture stderr then you will still need to use the stderr directive to redirect to a filename; you can’t use the stderr shortcut in a cwl.outputs.json file.

Likewise for stdout.

I would be happy to see updates to the documentation for this, yes!

The cwl.output.json feature is tested in the non-optional CWL conformance tests, so you can be assured of it working with any conformant CWL implementation.

1 Like