dnanexus/dxCompiler

ParsingException when compiling CWL

Closed this issue · 2 comments

Hi all,

I am looking into how to use dxCompiler with some trivial CWL files but I am not getting very far. Perhaps I am doing something wrong?

It appears to try and parse the CWL file as JSON, even though my file is in YAML, which is certainly allowed by the CWL standard. But perhaps not by dxCompiler?

$ java -jar /dxCompiler.jar compile workflows/hello-world-plain.cwl -language CWL -verbose
Warning: no DNAnexus security context found.
[error] Error creating translator for workflows/hello-world-plain.cwl
spray.json.JsonParser$ParsingException: Unexpected character 'c' at input index 0 (line 1, position 1), expected JSON Value:
cwlVersion: v1.2
^

        at spray.json.JsonParser.fail(JsonParser.scala:237)
        at spray.json.JsonParser.value(JsonParser.scala:79)
        at spray.json.JsonParser.parseJsValue(JsonParser.scala:51)
        at spray.json.JsonParser.parseJsValue(JsonParser.scala:47)
        at spray.json.JsonParser$.apply(JsonParser.scala:30)
        at spray.json.RichString.parseJson(package.scala:50)
        at dx.util.JsUtils$.jsFromFile(JsUtils.scala:10)
        at dx.cwl.Parser.parseFile(Parser.scala:213)
        at dx.translator.cwl.CwlTranslatorFactory.create(CwlTranslator.scala:259)
        at dx.translator.TranslatorFactory$$anonfun$createTranslator$6.applyOrElse(Translator.scala:103)
        at dx.translator.TranslatorFactory$$anonfun$createTranslator$6.applyOrElse(Translator.scala:104)
        at scala.collection.IterableOnceOps.collectFirst(IterableOnce.scala:1086)
        at scala.collection.IterableOnceOps.collectFirst$(IterableOnce.scala:1078)
        at scala.collection.AbstractIterable.collectFirst(Iterable.scala:920)
        at dx.translator.TranslatorFactory$.createTranslator(Translator.scala:104)
        at dxCompiler.Main$.compile(Main.scala:418)
        at dxCompiler.Main$.dispatchCommand(Main.scala:799)
        at dxCompiler.Main$.main(Main.scala:919)
        at dxCompiler.MainApp$.delayedEndpoint$dxCompiler$MainApp$1(Main.scala:924)
        at dxCompiler.MainApp$delayedInit$body.apply(Main.scala:923)
        at scala.Function0.apply$mcV$sp(Function0.scala:39)
        at scala.Function0.apply$mcV$sp$(Function0.scala:39)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
        at scala.App.$anonfun$main$1(App.scala:73)
        at scala.App.$anonfun$main$1$adapted(App.scala:73)
        at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:553)
        at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:551)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:920)
        at scala.App.main(App.scala:73)
        at scala.App.main$(App.scala:71)
        at dxCompiler.MainApp$.main(Main.scala:923)
        at dxCompiler.MainApp.main(Main.scala)

with hello-world-plain.cwl:

cwlVersion: v1.2
class: CommandLineTool

baseCommand:
  - echo
  - Hello World!
stdout: output.txt
inputs: {}
outputs:
  hello-world-plain/example_out:
    type: stdout

Hi please try to pack it into JSON format with cwltool --pack hello-world-plain.cwl > hello-world-plain.cwl.json and compile the packed one. And you can use cwltool --make-template to generate a temp input yaml and append the modified yaml using the -inputs flag when compiling.

Hi @tschoonj, we've added an example on how to start with CWL compilation to the DNAnexus platform: https://github.com/dnanexus/dxCompiler#cwl.
Please let us know if you run into any other issues with the compiler. Thanks!