Skip to content

Commit

Permalink
Remove dependency on task graph branch
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Apr 28, 2023
1 parent f46f506 commit cf5f8df
Show file tree
Hide file tree
Showing 33 changed files with 206 additions and 553 deletions.
3 changes: 0 additions & 3 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,6 @@ The following settings are available:
`dag.overwrite`
: When `true` overwrites any existing DAG file with the same name.

`dag.type`
: Can be `abstract` to render the abstract (process) DAG or `concrete` to render the concrete (task) DAG (default: `abstract`).

Read the {ref}`dag-visualisation` page to learn more about the execution graph that can be generated by Nextflow.

(config-docker)=
Expand Down
9 changes: 0 additions & 9 deletions modules/nextflow/src/main/groovy/nextflow/Session.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import nextflow.conda.CondaConfig
import nextflow.config.Manifest
import nextflow.container.ContainerConfig
import nextflow.dag.DAG
import nextflow.dag.ConcreteDAG
import nextflow.exception.AbortOperationException
import nextflow.exception.AbortSignalException
import nextflow.exception.IllegalConfigException
Expand Down Expand Up @@ -194,8 +193,6 @@ class Session implements ISession {

private DAG dag

private ConcreteDAG concreteDag

private CacheDB cache

private Barrier processesBarrier = new Barrier()
Expand Down Expand Up @@ -348,7 +345,6 @@ class Session implements ISession {

// -- DAG object
this.dag = new DAG()
this.concreteDag = new ConcreteDAG()

// -- init work dir
this.workDir = ((config.workDir ?: 'work') as Path).complete()
Expand Down Expand Up @@ -803,8 +799,6 @@ class Session implements ISession {

DAG getDag() { this.dag }

ConcreteDAG getConcreteDAG() { this.concreteDag }

ExecutorService getExecService() { execService }

/**
Expand Down Expand Up @@ -1024,9 +1018,6 @@ class Session implements ISession {
final trace = handler.safeTraceRecord()
cache.putTaskAsync(handler, trace)

// save the task meta file to the task directory
handler.writeMetaFile()

// notify the event to the observers
for( int i=0; i<observers.size(); i++ ) {
final observer = observers.get(i)
Expand Down
125 changes: 0 additions & 125 deletions modules/nextflow/src/main/groovy/nextflow/dag/ConcreteDAG.groovy

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import java.nio.file.Path
class CytoscapeHtmlRenderer implements DagRenderer {

@Override
void renderAbstractGraph(DAG dag, Path file) {
void renderDocument(DAG dag, Path file) {
String tmplPage = readTemplate()
String network = CytoscapeJsRenderer.renderNetwork(dag)
file.text = tmplPage.replaceAll(~/\/\* REPLACE_WITH_NETWORK_DATA \*\//, network)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import java.nio.file.Path
class CytoscapeJsRenderer implements DagRenderer {

@Override
void renderAbstractGraph(DAG dag, Path file) {
void renderDocument(DAG dag, Path file) {
file.text = renderNetwork(dag)
}

Expand Down
2 changes: 1 addition & 1 deletion modules/nextflow/src/main/groovy/nextflow/dag/DAG.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import nextflow.script.params.TupleOutParam
import java.util.concurrent.atomic.AtomicLong

/**
* Model the abstract graph of a pipeline execution.
* Model a direct acyclic graph of the pipeline execution.
*
* @author Paolo Di Tommaso <[email protected]>
*/
Expand Down
15 changes: 3 additions & 12 deletions modules/nextflow/src/main/groovy/nextflow/dag/DagRenderer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,10 @@ import java.nio.file.Path
* @author Paolo Di Tommaso <[email protected]>
* @author Mike Smoot <[email protected]>
*/
trait DagRenderer {
interface DagRenderer {

/**
* Render an abstract (process) DAG.
* Render the dag to the specified file.
*/
void renderAbstractGraph(DAG dag, Path file) {
throw new UnsupportedOperationException("Abstract graph rendering is not supported for this file format")
}

/**
* Render a concrete (task) DAG.
*/
void renderConcreteGraph(ConcreteDAG dag, Path file) {
throw new UnsupportedOperationException("Concrete graph rendering is not supported for this file format")
}
void renderDocument(DAG dag, Path file);
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DotRenderer implements DagRenderer {
static String normalise(String str) { str.replaceAll(/[^0-9_A-Za-z]/,'') }

@Override
void renderAbstractGraph(DAG dag, Path file) {
void renderDocument(DAG dag, Path file) {
file.text = renderNetwork(dag)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GexfRenderer implements DagRenderer {
}

@Override
void renderAbstractGraph(DAG dag, Path file) {
void renderDocument(DAG dag, Path file) {
final Charset charset = Charset.defaultCharset()
Writer bw = Files.newBufferedWriter(file, charset)
final XMLOutputFactory xof = XMLOutputFactory.newFactory()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GraphvizRenderer implements DagRenderer {
* See http://www.graphviz.org for more info.
*/
@Override
void renderAbstractGraph(DAG dag, Path target) {
void renderDocument(DAG dag, Path target) {
def result = Files.createTempFile('nxf-',".$format")
def temp = Files.createTempFile('nxf-','.dot')
// save the DAG as `dot` to a temp file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import java.nio.file.Path
class MermaidRenderer implements DagRenderer {

@Override
void renderAbstractGraph(DAG dag, Path file) {
void renderDocument(DAG dag, Path file) {
file.text = renderNetwork(dag)
}

String renderNetwork(DAG dag) {
def lines = []
lines << "flowchart TD"

Expand All @@ -40,7 +44,7 @@ class MermaidRenderer implements DagRenderer {

lines << ""

file.text = lines.join('\n')
return lines.join('\n')
}

private String renderVertex(DAG.Vertex vertex) {
Expand Down Expand Up @@ -71,49 +75,4 @@ class MermaidRenderer implements DagRenderer {

return "${edge.from.name} -->${label} ${edge.to.name}"
}

@Override
void renderConcreteGraph(ConcreteDAG graph, Path file) {
def renderedOutputs = [] as Set<Path>
def numInputs = 0
def numOutputs = 0

def lines = []
lines << "flowchart TD"

// render tasks and task inputs
graph.nodes.values().each { task ->
// render task node
lines << " ${task.getSlug()}[\"${task.label}\"]"

task.inputs.each { input ->
// render task input from predecessor
if( input.predecessor != null ) {
final pred = graph.nodes[input.predecessor]
lines << " ${pred.getSlug()} -->|${input.name}| ${task.getSlug()}"
renderedOutputs << input.path
}

// render task input from source node
else {
numInputs += 1
lines << " i${numInputs}(( )) -->|${input.name}| ${task.getSlug()}"
}
}
}

// render task outputs with sink nodes
graph.nodes.values().each { task ->
task.outputs.each { output ->
if( output.path !in renderedOutputs ) {
numOutputs += 1
lines << " ${task.getSlug()} -->|${output.name}| o${numOutputs}(( ))"
}
}
}

lines << ""

file.text = lines.join('\n')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class NodeMarker {
static private Session getSession() { Global.session as Session }

/**
* Creates a vertex in the abstract DAG representing a computing `process`
* Creates a new vertex in the DAG representing a computing `process`
*
* @param label The label associated to the process
* @param inputs The list of inputs entering in the process
Expand All @@ -52,7 +52,7 @@ class NodeMarker {
}

/**
* Creates a vertex in the abstract DAG representing a dataflow operator
* Creates a new DAG vertex representing a dataflow operator
*
* @param label The operator label
* @param inputs The operator input(s). It can be either a single channel or a list of channels.
Expand All @@ -66,7 +66,7 @@ class NodeMarker {
}

/**
* Creates a vertex in the abstract DAG representing a dataflow channel source.
* Creates a vertex in the DAG representing a dataflow channel source.
*
* @param label The node description
* @param source Either a dataflow channel or a list of channel.
Expand Down
Loading

0 comments on commit cf5f8df

Please sign in to comment.