# Workflow diagram

The following diagram is a high-level overview of the Nextflow source code in a similar style as the [workflow diagram][workflow-diagram] visualization for Nextflow pipelines. Each node and subgraph is a class. Arrows depict the flow of data and/or communication between classes.

In general, nodes with sharp corners are "record" classes that simply hold information, while nodes with rounded edges are "function" classes that transform some input into an output. Subgraphs are either long-running classes, i.e. "places where things happen", or one of the other two types for which it was useful to expand and show internal details.

```mermaid
flowchart TB
  subgraph Launcher
    subgraph CmdRun
      subgraph AssetManager
        ScriptFile
      end
      subgraph ConfigBuilder
        ConfigParser([ConfigParser])
        ConfigBase([ConfigBase])
      end
      subgraph ScriptRunner
        subgraph Session
          ConfigMap
          DAG
          ExecutorFactory([ExecutorFactory])
          subgraph TaskProcessor
            TaskRun
          end
          subgraph Executor
            subgraph TaskMonitor
              TaskHandler
            end
            TaskBean
            BashWrapperBuilder([BashWrapperBuilder])
          end
          TraceRecord
          CacheFactory([CacheFactory])
          CacheDB
          TraceObserver([TraceObserver])
        end
        ScriptParser([ScriptParser])
        BaseScript([BaseScript])
        subgraph ScriptMeta
          WorkflowDef([WorkflowDef])
          ProcessDef([ProcessDef])
          FunctionDef([FunctionDef])
        end
        IncludeDef([IncludeDef])
        OpCall([OpCall])
      end
      ConfigParser --> ConfigBase
      ConfigBase --> ConfigMap
      ScriptFile --> ScriptParser
      ScriptParser --> BaseScript
      BaseScript --> WorkflowDef
      BaseScript --> ProcessDef
      BaseScript --> FunctionDef
      BaseScript --> IncludeDef
      IncludeDef --> ScriptParser
      WorkflowDef --> OpCall
      OpCall --> DAG
      ProcessDef --> DAG
      DAG --> TaskRun
      TaskRun --> DAG
      ExecutorFactory --> Executor
      ConfigMap --> Executor
      ProcessDef --> TaskProcessor
      ConfigMap --> TaskProcessor
      TaskRun --> TaskHandler
      TaskRun --> TaskBean
      TaskBean --> BashWrapperBuilder
      BashWrapperBuilder --> TaskHandler
      CacheFactory --> CacheDB
      TaskHandler --> CacheDB
      TaskHandler --> TraceRecord
      TraceRecord --> CacheDB
      TaskHandler --> TraceObserver
    end
  end
```

[workflow-diagram]: ../reports#workflow-diagram
