From 7cb6b1d1b957175ab126e08c13425f5794708c79 Mon Sep 17 00:00:00 2001 From: Ruchi Munshi Date: Fri, 30 Jun 2017 13:27:46 -0400 Subject: [PATCH 1/9] Update wdltool version from 0.13 to 0.14 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2e1c112..07efa1e 100644 --- a/build.sbt +++ b/build.sbt @@ -12,7 +12,7 @@ val wdl4sV = "0.13" lazy val versionSettings = Seq( // Upcoming release, or current if we're on the master branch - git.baseVersion := "0.13", + git.baseVersion := "0.14", // Shorten the git commit hash git.gitHeadCommit := git.gitHeadCommit.value map { _.take(7) }, From 9757a16ec2df118be4f1fc82f92b83a6d73dd794 Mon Sep 17 00:00:00 2001 From: Chris Llanwarne Date: Sat, 22 Jul 2017 10:41:07 -0400 Subject: [PATCH 2/9] Better graphs for scatters using subgraphs --- build.sbt | 20 +++++- src/main/scala/wdltool/GraphPrint.scala | 86 +++++++++++++++---------- src/main/scala/wdltool/Main.scala | 13 ++-- src/test/scala/wdltool/SampleWdl.scala | 8 +-- 4 files changed, 81 insertions(+), 46 deletions(-) diff --git a/build.sbt b/build.sbt index 07efa1e..66eaed0 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ organization := "org.broadinstitute" scalaVersion := "2.12.1" -val wdl4sV = "0.13" +val wdl4sV = "0.14-7c693a3-SNAP" lazy val versionSettings = Seq( // Upcoming release, or current if we're on the master branch @@ -35,11 +35,27 @@ resolvers ++= Seq( "Broad Artifactory Snapshots" at "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot/" ) +lazy val catsDependencies = List( + "org.typelevel" %% "cats" % "0.9.0", + "org.typelevel" %% "kittens" % "1.0.0-M10", + "com.github.benhutchison" %% "mouse" % "0.9" +) map (_ + /* + Exclude test framework cats-laws and its transitive dependency scalacheck. + If sbt detects scalacheck, it tries to run it. + Explicitly excluding the two problematic artifacts instead of including the three (or four?). + https://github.com/typelevel/cats/tree/v0.7.2#getting-started + Re "_2.12", see also: https://github.com/sbt/sbt/issues/1518 + */ + exclude("org.typelevel", "cats-laws_2.12") + exclude("org.typelevel", "cats-kernel-laws_2.12") + ) + libraryDependencies ++= Seq( "org.broadinstitute" %% "wdl4s" % wdl4sV, //---------- Test libraries -------------------// "org.scalatest" %% "scalatest" % "3.0.1" % Test -) +) ++ catsDependencies val customMergeStrategy: String => MergeStrategy = { case x if Assembly.isConfigFile(x) => diff --git a/src/main/scala/wdltool/GraphPrint.scala b/src/main/scala/wdltool/GraphPrint.scala index 6bb12ff..2125c8a 100644 --- a/src/main/scala/wdltool/GraphPrint.scala +++ b/src/main/scala/wdltool/GraphPrint.scala @@ -1,71 +1,89 @@ package wdltool import java.nio.file.{Files, Paths} +import java.util.concurrent.atomic.AtomicInteger + +import wdl4s.wdl.{CallOutput, Declaration, If, Scatter, WdlCall, _} +import wdl4s.wdl.WdlGraphNode -import wdl4s.{CallOutput, Declaration, If, Scatter, _} import scala.collection.JavaConverters._ +import cats.implicits._ +import cats.derived.monoid._, legacy._ + object GraphPrint { - case class WorkflowDigraph(workflowName: String, digraph: Set[String]) + final case class WorkflowDigraph(workflowName: String, digraph: NodesAndLinks) + final case class NodesAndLinks(nodes: Set[String], links: Set[String]) def generateWorkflowDigraph(file: String, allNodesMode: Boolean): WorkflowDigraph = { // It's ok to use .get here, we're happy to throw an exception and crash the program! val namespace = WdlNamespaceWithWorkflow.load(Files.readAllLines(Paths.get(file)).asScala.mkString(System.lineSeparator()), Seq(WdlNamespace.fileResolver _)).get - val digraph = if (allNodesMode) { - listAllGraphNodes(namespace) - } else { - val executables = GraphPrint.listExecutableGraphNodes(namespace.workflow) - listAllGraphNodes(namespace, graphNode => executables.contains(graphNode)) - } + val digraph = listAllGraphNodes(namespace.workflow) WorkflowDigraph(namespace.workflow.unqualifiedName, digraph) } - private def defaultFilter: GraphNode => Boolean = _ => true + private val clusterCount: AtomicInteger = new AtomicInteger(0) + + + private def listAllGraphNodes(scope: Scope): NodesAndLinks = { + + val callsAndDeclarations: Set[WdlGraphNode] = (scope.children collect { + case w: WdlGraphNode if isCallOrDeclaration(w) => w + }).toSet - private def listAllGraphNodes(namespace: WdlNamespaceWithWorkflow, filter: GraphNode => Boolean = defaultFilter): Set[String] = { + val subGraphs: Set[WdlGraphNode] = (scope.children collect { + case s: Scatter => s + case i: If => i + }).toSet - val graphNodes = namespace.descendants collect { - case g: GraphNode if filter(g) => g + def upstreamLinks(wdlGraphNode: WdlGraphNode, graphNodeName: String, suffix: String = ""): Set[String] = wdlGraphNode.upstream collect { + case upstream: WdlGraphNode if isCallOrDeclaration(upstream) => + val upstreamName = graphName(upstream) + s""""$upstreamName" -> "$graphNodeName" $suffix""" } - graphNodes flatMap { graphNode => + val thisLevelNodesAndLinks: NodesAndLinks = callsAndDeclarations foldMap { graphNode => val name = graphName(graphNode) val initialSet: Set[String] = graphNode match { - case c: Call => Set(s""""${dotSafe(name)}"""") + case w: WdlGraphNode if isCallOrDeclaration(w) => Set(s""""$name"""") case _ => Set.empty } - val upstreamLinks = graphNode.upstream collect { - case upstream if filter(upstream) => - val upstreamName = graphName(upstream) - s""""${dotSafe(upstreamName)}" -> "${dotSafe(name)}"""" - } - initialSet ++ upstreamLinks + val fromStart = if (graphNode.upstream.isEmpty) Set(s""""start" -> "$name"""") else Set.empty + + NodesAndLinks(initialSet, upstreamLinks(graphNode, name) ++ fromStart) } - } - private def listExecutableGraphNodes(s: Scope): Set[GraphNode] = { - s.children.toSet flatMap { child: Scope => child match { - case call: Call => Set[GraphNode](call) - case scatter: Scatter => Set[GraphNode](scatter) ++ listExecutableGraphNodes(scatter) - case i: If => Set[GraphNode](i) ++ listExecutableGraphNodes(i) - case declaration: Declaration => Set[GraphNode](declaration) - case _ => Set.empty[GraphNode] - }} + val subGraphNodesAndLinks: NodesAndLinks = subGraphs foldMap { wdlGraphNode => + val clusterName = "cluster_" + clusterCount.getAndIncrement() + val subGraphName = graphName(wdlGraphNode) + val subNodes = listAllGraphNodes(wdlGraphNode) + val scope = s""" + |subgraph $clusterName { + | ${subNodes.nodes.mkString(sep="\n ")} + | "$subGraphName" [shape=plaintext] + |} + """.stripMargin + + NodesAndLinks(Set(scope), subNodes.links ++ upstreamLinks(wdlGraphNode, subGraphName, s"[lhead=$clusterName]")) + } + + thisLevelNodesAndLinks |+| subGraphNodesAndLinks } + private def isCallOrDeclaration(w: WdlGraphNode): Boolean = w.isInstanceOf[WdlCall] || w.isInstanceOf[Declaration] private def dotSafe(s: String) = s.replaceAllLiterally("\"", "\\\"") - private def graphName(g: GraphNode): String = g match { + private def graphName(g: WdlGraphNode): String = dotSafe(g match { case d: Declaration => val exprString = d.expression.map(e => " = " + e.toWdlString).getOrElse("") - s"${d.wdlType.toWdlString} ${d.fullyQualifiedName}$exprString" - case c: Call => - s"call ${c.fullyQualifiedName}" + s"${d.wdlType.toWdlString} ${d.unqualifiedName}$exprString" + case c: WdlCall => + s"call ${c.unqualifiedName}" case i: If => s"if (${i.condition.toWdlString})" case s: Scatter => @@ -74,5 +92,5 @@ object GraphPrint { val exprString = c.expression.map(e => " = " + e.toWdlString).getOrElse("") s"output { ${c.fullyQualifiedName}$exprString }" case other => s"${other.getClass.getSimpleName}: ${other.fullyQualifiedName}" - } + }) } diff --git a/src/main/scala/wdltool/Main.scala b/src/main/scala/wdltool/Main.scala index 28bdaef..da4231b 100644 --- a/src/main/scala/wdltool/Main.scala +++ b/src/main/scala/wdltool/Main.scala @@ -2,12 +2,11 @@ package wdltool import java.nio.file.Paths -import wdl4s.formatter.{AnsiSyntaxHighlighter, HtmlSyntaxHighlighter, SyntaxFormatter} -import wdl4s._ +import wdl4s.wdl.formatter.{AnsiSyntaxHighlighter, HtmlSyntaxHighlighter, SyntaxFormatter} +import wdl4s.wdl._ import spray.json._ - -import scala.util.{Failure, Success, Try} +import scala.util.{Failure, Success} object Main extends App { sealed trait Termination { @@ -57,7 +56,7 @@ object Main extends App { def inputs(args: Seq[String]): Termination = { continueIf(args.length == 1) { loadWdl(args.head) { namespace => - import wdl4s.types.WdlTypeJsonFormatter._ + import wdl4s.wdl.types.WdlTypeJsonFormatter._ val msg = namespace match { case x: WdlNamespaceWithWorkflow => x.workflow.inputs.toJson.prettyPrint case _ => "WDL does not have a local workflow" @@ -84,7 +83,9 @@ object Main extends App { val workflowDigraph = GraphPrint.generateWorkflowDigraph(file, allNodesMode) val result = s"""|digraph ${workflowDigraph.workflowName} { - | ${workflowDigraph.digraph.mkString(System.lineSeparator + " ")} + | compound=true; + | ${workflowDigraph.digraph.links.mkString(System.lineSeparator + " ")} + | ${workflowDigraph.digraph.nodes.mkString(System.lineSeparator + " ")} |} |""" SuccessfulTermination(result.stripMargin) diff --git a/src/test/scala/wdltool/SampleWdl.scala b/src/test/scala/wdltool/SampleWdl.scala index d2179b9..4326449 100644 --- a/src/test/scala/wdltool/SampleWdl.scala +++ b/src/test/scala/wdltool/SampleWdl.scala @@ -4,13 +4,13 @@ import java.io.{FileWriter, File} import java.nio.file.{Files, Path} import spray.json._ -import wdl4s._ -import wdl4s.values._ +import wdl4s.wdl._ +import wdl4s.wdl.values._ import scala.language.postfixOps trait SampleWdl { - def wdlSource(runtime: String = ""): WdlSource + def wdlSource(runtime: String = ""): WorkflowSource def rawInputs: WorkflowRawInputs def name = getClass.getSimpleName.stripSuffix("$") @@ -35,7 +35,7 @@ trait SampleWdl { def read(value: JsValue) = throw new NotImplementedError(s"Reading JSON not implemented: $value") } - def wdlJson: WdlJson = rawInputs.toJson.prettyPrint + def wdlJson: WorkflowJson = rawInputs.toJson.prettyPrint def createFileArray(base: Path): Unit = { createFile("f1", base, "line1\nline2\n") From af5b296189c6bc794364d721f44928319176bac4 Mon Sep 17 00:00:00 2001 From: Phil Shapiro Date: Mon, 31 Jul 2017 14:14:27 -0400 Subject: [PATCH 3/9] - fix issue where an error, such as a validation failure, wouldn't result in a non-zero exit code --- src/main/scala/wdltool/Main.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/wdltool/Main.scala b/src/main/scala/wdltool/Main.scala index da4231b..d2d0c9d 100644 --- a/src/main/scala/wdltool/Main.scala +++ b/src/main/scala/wdltool/Main.scala @@ -157,5 +157,5 @@ object Main extends App { case BadUsageTermination => Console.err.println(UsageMessage) } - termination.returnCode + sys.exit(termination.returnCode) } From 4e9120c7405bbd939a89879fa97b085dbbd32abd Mon Sep 17 00:00:00 2001 From: Chris Llanwarne Date: Mon, 7 Aug 2017 16:03:27 -0400 Subject: [PATCH 4/9] For our own benefit, a first attempt at drawing pictures of WOM graphs --- build.sbt | 2 +- src/main/scala/wdltool/Main.scala | 42 ++++++-- .../wdltool/{ => graph}/GraphPrint.scala | 13 ++- .../scala/wdltool/graph/WomGraphPrint.scala | 97 +++++++++++++++++++ src/main/scala/wdltool/graph/package.scala | 42 ++++++++ 5 files changed, 179 insertions(+), 17 deletions(-) rename src/main/scala/wdltool/{ => graph}/GraphPrint.scala (95%) create mode 100644 src/main/scala/wdltool/graph/WomGraphPrint.scala create mode 100644 src/main/scala/wdltool/graph/package.scala diff --git a/build.sbt b/build.sbt index 66eaed0..0ce30d6 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ organization := "org.broadinstitute" scalaVersion := "2.12.1" -val wdl4sV = "0.14-7c693a3-SNAP" +val wdl4sV = "0.14-607f162-SNAP" lazy val versionSettings = Seq( // Upcoming release, or current if we're on the master branch diff --git a/src/main/scala/wdltool/Main.scala b/src/main/scala/wdltool/Main.scala index da4231b..bb457da 100644 --- a/src/main/scala/wdltool/Main.scala +++ b/src/main/scala/wdltool/Main.scala @@ -5,6 +5,7 @@ import java.nio.file.Paths import wdl4s.wdl.formatter.{AnsiSyntaxHighlighter, HtmlSyntaxHighlighter, SyntaxFormatter} import wdl4s.wdl._ import spray.json._ +import wdltool.graph.{GraphPrint, WomGraphPrint} import scala.util.{Failure, Success} @@ -34,6 +35,7 @@ object Main extends App { case Some(x) if x == Actions.Inputs => inputs(args.tail) case Some(x) if x == Actions.Parse => parse(args.tail) case Some(x) if x == Actions.Graph => graph(args.tail) + case Some(x) if x == Actions.Womgraph => womGraph(args.tail) case _ => BadUsageTermination } } @@ -74,13 +76,28 @@ object Main extends App { } def graph(args: Seq[String]): Termination = { - continueIf(args.length == 1 || (args.length == 2 && args.head.equals("--all"))) { + continueIf(args.length == 1) { + + val file = args.head + + val workflowDigraph = GraphPrint.generateWorkflowDigraph(file) + + val result = s"""|digraph ${workflowDigraph.workflowName} { + | compound=true; + | ${workflowDigraph.digraph.links.mkString(System.lineSeparator + " ")} + | ${workflowDigraph.digraph.nodes.mkString(System.lineSeparator + " ")} + |} + |""" + SuccessfulTermination(result.stripMargin) + } + } + + def womGraph(args: Seq[String]): Termination = { + continueIf(args.nonEmpty) { - val (file, allNodesMode) = - if (args.size == 1) (args.head, false) - else (args(1), true) + val (mainFile, auxFiles) = (args.head, args.tail) - val workflowDigraph = GraphPrint.generateWorkflowDigraph(file, allNodesMode) + val workflowDigraph = WomGraphPrint.generateWorkflowDigraph(mainFile, auxFiles) val result = s"""|digraph ${workflowDigraph.workflowName} { | compound=true; @@ -108,7 +125,7 @@ object Main extends App { } yield action object Actions extends Enumeration { - val Parse, Validate, Highlight, Inputs, Graph = Value + val Parse, Validate, Highlight, Inputs, Graph, Womgraph = Value } val UsageMessage = """ @@ -140,13 +157,20 @@ object Main extends App { | otherwise. Note that higher-level AST checks are not done | via this sub-command and the 'validate' subcommand should | be used for full validation. - |graph [--all] + | + |graph | | Reads a WDL file against the grammar and prints out a | .dot of the DAG if it is valid, and a syntax error | otherwise. - | Use [--all] to show all graph nodes in the WDL spec, - | even the non-executable nodes. + | + |womgraph [ancillary files] + | + | Reads a WDL or CWL file from the first argument and + | converts it to a WOM representation then prints out a graph + | of the WOM produced. + | Any imported files can be supplied as subsequent arguments. + | """.stripMargin val termination = dispatchCommand(args) diff --git a/src/main/scala/wdltool/GraphPrint.scala b/src/main/scala/wdltool/graph/GraphPrint.scala similarity index 95% rename from src/main/scala/wdltool/GraphPrint.scala rename to src/main/scala/wdltool/graph/GraphPrint.scala index 2125c8a..d00ae69 100644 --- a/src/main/scala/wdltool/GraphPrint.scala +++ b/src/main/scala/wdltool/graph/GraphPrint.scala @@ -1,22 +1,21 @@ -package wdltool +package wdltool.graph import java.nio.file.{Files, Paths} import java.util.concurrent.atomic.AtomicInteger -import wdl4s.wdl.{CallOutput, Declaration, If, Scatter, WdlCall, _} -import wdl4s.wdl.WdlGraphNode +import cats.derived.monoid._ +import cats.derived.monoid.legacy._ +import cats.implicits._ +import wdl4s.wdl.{CallOutput, Declaration, If, Scatter, WdlCall, WdlGraphNode, _} import scala.collection.JavaConverters._ -import cats.implicits._ -import cats.derived.monoid._, legacy._ - object GraphPrint { final case class WorkflowDigraph(workflowName: String, digraph: NodesAndLinks) final case class NodesAndLinks(nodes: Set[String], links: Set[String]) - def generateWorkflowDigraph(file: String, allNodesMode: Boolean): WorkflowDigraph = { + def generateWorkflowDigraph(file: String): WorkflowDigraph = { // It's ok to use .get here, we're happy to throw an exception and crash the program! val namespace = WdlNamespaceWithWorkflow.load(Files.readAllLines(Paths.get(file)).asScala.mkString(System.lineSeparator()), Seq(WdlNamespace.fileResolver _)).get diff --git a/src/main/scala/wdltool/graph/WomGraphPrint.scala b/src/main/scala/wdltool/graph/WomGraphPrint.scala new file mode 100644 index 0000000..6ad0f79 --- /dev/null +++ b/src/main/scala/wdltool/graph/WomGraphPrint.scala @@ -0,0 +1,97 @@ +package wdltool.graph + +import java.nio.file.{Files, Paths} +import java.util.concurrent.atomic.AtomicInteger + +import cats.data.Validated.{Invalid, Valid} +import cats.derived.monoid._ +import cats.derived.monoid.legacy._ +import cats.implicits._ +import wdl4s.cwl.{CommandLineTool, CwlCodecs, Workflow, Yaml} +import wdl4s.wdl.{WdlNamespace, WdlNamespaceWithWorkflow} +import wdl4s.wom.executable.Executable +import wdl4s.wom.graph.{Graph, GraphNode} + +import scala.collection.JavaConverters._ +import wdltool.graph._ + +object WomGraphPrint { + + final case class WorkflowDigraph(workflowName: String, digraph: NodesAndLinks) + final case class NodesAndLinks(nodes: Set[String], links: Set[String]) + + def readFile(filePath: String): String = Files.readAllLines(Paths.get(filePath)).asScala.mkString(System.lineSeparator()) + + def womExecutableFromWdl(filePath: String): Executable = { + val namespace = WdlNamespaceWithWorkflow.load(readFile(filePath), Seq(WdlNamespace.fileResolver _)).get + namespace.womExecutable + } + + def womExecutableFromCwl(filePath: String): Executable = { + val yaml: Yaml = readFile(filePath) + CwlCodecs.decodeCwl(yaml) match { + case Right((clt: CommandLineTool, _)) => + clt.womExecutable match { + case Valid(wom) => wom + case Invalid(e) => throw new Exception(s"Can't build WOM executable from CWL CommandLineTool: ${e.toList.mkString("\n", "\n", "\n")}") + } + case Right((wf: Workflow, m)) if m.isEmpty => + wf.womExecutable(Map.empty) match { + case Valid(wom) => wom + case Invalid(e) => throw new Exception(s"Can't build WOM executable from CWL Workflow: ${e.toList.mkString("\n", "\n", "\n")}") + } + // TODO: Don't throw away the error information! Might as well return it: + case other => throw new Exception(s"Can't read $filePath") + } + } + + def generateWorkflowDigraph(file: String, auxFiles: Seq[String]): WorkflowDigraph = { + + val womExecutable = if (file.toLowerCase().endsWith("wdl")) womExecutableFromWdl(file) else womExecutableFromCwl(file) + womExecutable.graph match { + case Valid(graph) => + val digraph = listAllGraphNodes (graph) + WorkflowDigraph (dotSafe(womExecutable.entryPoint.name), digraph) + case Invalid(errors) => + throw new IllegalArgumentException(errors.toList.mkString("\n", "\n", "\n")) + } + } + + private val clusterCount: AtomicInteger = new AtomicInteger(0) + + private def listAllGraphNodes(graph: Graph): NodesAndLinks = { + + graph.nodes foldMap nodesAndLinks + } + + private def nodesAndLinks(graphNode: GraphNode): NodesAndLinks = graphNode match { + case other => defaultNodesAndLinks(graphNode) + } + + /** + * For most graph nodes, we draw a single box for the node, containing the name and input and output ports. + * For each input/output port, we include the links to upstream ports. + */ + private def defaultNodesAndLinks(graphNode: GraphNode): NodesAndLinks = { + val clusterName = "cluster_" + clusterCount.getAndIncrement() + val portNodes = (graphNode.outputPorts ++ graphNode.inputPorts) map { p => + s"${p.graphId} [shape=${p.graphShape} label=${p.graphName}];" + } + val links = for { + inputPort <- graphNode.inputPorts + upstreamPort = inputPort.upstream + } yield s"${upstreamPort.graphId} -> ${inputPort.graphId}" + + val singleNode = + s""" + |subgraph $clusterName { + | style=filled; + | fillcolor=${graphNode.graphFillColor}; + | ${portNodes.mkString(sep="\n ")} + | ${graphNode.graphId} [shape=plaintext label=${graphNode.graphName}] + |} + |""".stripMargin + + NodesAndLinks(Set(singleNode), links) + } +} diff --git a/src/main/scala/wdltool/graph/package.scala b/src/main/scala/wdltool/graph/package.scala new file mode 100644 index 0000000..f21caaa --- /dev/null +++ b/src/main/scala/wdltool/graph/package.scala @@ -0,0 +1,42 @@ +package wdltool + +import wdl4s.wom.graph.GraphNodePort.{InputPort, OutputPort} +import wdl4s.wom.graph._ + +package object graph { + + private[graph] def dotSafe(s: String) = s""""${s.replaceAllLiterally("\"", "\\\"")}"""" + + private[graph] implicit class GraphNodeGraphics(val graphNode: GraphNode) extends AnyVal { + def graphFillColor = graphNode match { + case _: GraphInputNode => "lightskyblue1" + case _: GraphOutputNode => "palegreen" + case _ => "white" + } + + def graphName: String = dotSafe(graphNode match { + case c: CallNode => + s"call ${c.name}" + case s: ScatterNode => + s"scatter ${s.scatterVariableMapping.graphInputNode.name}" + case gin: GraphInputNode => + s"${gin.womType.toWdlString} ${gin.name}" + case gon: GraphOutputNode => + s"${gon.womType.toWdlString} ${gon.name}" + case other => + throw new Exception(s"Can't name $other") + }) + + def graphId: String = dotSafe("NODE" + graphNode.hashCode().toString) + } + + private[graph] implicit class GraphNodePortGraphics(val graphNodePort: GraphNodePort) extends AnyVal { + def graphShape = graphNodePort match { + case _: InputPort => "oval" + case _: OutputPort => "hexagon" + } + + def graphName: String = dotSafe(graphNodePort.name) + def graphId: String = dotSafe("PORT" + graphNodePort.hashCode().toString) + } +} From a8620051ff75855aee561201f2fd207adc9f8e56 Mon Sep 17 00:00:00 2001 From: Chris Llanwarne Date: Mon, 7 Aug 2017 16:03:27 -0400 Subject: [PATCH 5/9] For our own benefit, a first attempt at drawing pictures of WOM graphs --- build.sbt | 3 ++- .../scala/wdltool/graph/WomGraphPrint.scala | 23 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/build.sbt b/build.sbt index 0ce30d6..0c7669d 100644 --- a/build.sbt +++ b/build.sbt @@ -52,7 +52,8 @@ lazy val catsDependencies = List( ) libraryDependencies ++= Seq( - "org.broadinstitute" %% "wdl4s" % wdl4sV, + "org.broadinstitute" %% "wdl4s-wdl" % wdl4sV, + "org.broadinstitute" %% "wdl4s-cwl" % wdl4sV, //---------- Test libraries -------------------// "org.scalatest" %% "scalatest" % "3.0.1" % Test ) ++ catsDependencies diff --git a/src/main/scala/wdltool/graph/WomGraphPrint.scala b/src/main/scala/wdltool/graph/WomGraphPrint.scala index 6ad0f79..9a66965 100644 --- a/src/main/scala/wdltool/graph/WomGraphPrint.scala +++ b/src/main/scala/wdltool/graph/WomGraphPrint.scala @@ -30,17 +30,18 @@ object WomGraphPrint { def womExecutableFromCwl(filePath: String): Executable = { val yaml: Yaml = readFile(filePath) CwlCodecs.decodeCwl(yaml) match { - case Right((clt: CommandLineTool, _)) => - clt.womExecutable match { - case Valid(wom) => wom - case Invalid(e) => throw new Exception(s"Can't build WOM executable from CWL CommandLineTool: ${e.toList.mkString("\n", "\n", "\n")}") - } - case Right((wf: Workflow, m)) if m.isEmpty => - wf.womExecutable(Map.empty) match { - case Valid(wom) => wom - case Invalid(e) => throw new Exception(s"Can't build WOM executable from CWL Workflow: ${e.toList.mkString("\n", "\n", "\n")}") - } - // TODO: Don't throw away the error information! Might as well return it: + // TODO: Re-add after https://github.com/broadinstitute/wdl4s/pull/161 +// case Right((clt: CommandLineTool, _)) => +// clt.womExecutable match { +// case Valid(wom) => wom +// case Invalid(e) => throw new Exception(s"Can't build WOM executable from CWL CommandLineTool: ${e.toList.mkString("\n", "\n", "\n")}") +// } +// case Right((wf: Workflow, m)) if m.isEmpty => +// wf.womExecutable(Map.empty) match { +// case Valid(wom) => wom +// case Invalid(e) => throw new Exception(s"Can't build WOM executable from CWL Workflow: ${e.toList.mkString("\n", "\n", "\n")}") +// } + // TODO: Don't throw away the error information! Might as well return it: case other => throw new Exception(s"Can't read $filePath") } } From 6346c257cdc0983c4c9c9c1506f3061f8af2c706 Mon Sep 17 00:00:00 2001 From: Khalid Shakir Date: Wed, 9 Aug 2017 22:39:07 -0400 Subject: [PATCH 6/9] Bumped pullapprove to v2. Added danbills. --- .pullapprove.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.pullapprove.yml b/.pullapprove.yml index 3ab4b6b..09b5f34 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -1,10 +1,19 @@ -approve_by_comment: true -approve_regex: ':\+1:' -reset_on_push: false -author_approval: ignored -reviewers: +# enabling version 2 turns github reviews on by default +version: 2 +group_defaults: + approve_by_comment: + enabled: true + approve_regex: ':\+1:' + reset_on_push: + enabled: false +groups: + reviewers: required: 2 - members: + github_reviews: + enabled: true + author_approval: + ignored: true + users: - Horneth - cjllanwarne - geoffjentry @@ -14,3 +23,4 @@ reviewers: - kshakir - mcovarr - ruchim + - danbills From 828cf617077571108d8dd05eca9ba20b57e779c1 Mon Sep 17 00:00:00 2001 From: Dan Billings Date: Mon, 14 Aug 2017 10:02:24 -0400 Subject: [PATCH 7/9] bump wdl4s version --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 0c7669d..cf3e14e 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ organization := "org.broadinstitute" scalaVersion := "2.12.1" -val wdl4sV = "0.14-607f162-SNAP" +val wdl4sV = "0.14" lazy val versionSettings = Seq( // Upcoming release, or current if we're on the master branch From 8b3fae70616d4ab231910801ec325d0f07b74439 Mon Sep 17 00:00:00 2001 From: Chris Llanwarne Date: Fri, 11 Aug 2017 16:46:06 -0400 Subject: [PATCH 8/9] travis.yml --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7defb90 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +sudo: false +language: scala +scala: + - 2.12.3 +jdk: + - oraclejdk8 +script: sbt clean test + From b563665b6fa22d1fb36f2bd4209ed7ed85dc091e Mon Sep 17 00:00:00 2001 From: Dan Billings Date: Wed, 16 Aug 2017 11:22:01 -0400 Subject: [PATCH 9/9] update wdl4s version --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index cf3e14e..f0f3e22 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ organization := "org.broadinstitute" scalaVersion := "2.12.1" -val wdl4sV = "0.14" +val wdl4sV = "0.15" lazy val versionSettings = Seq( // Upcoming release, or current if we're on the master branch