Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve rendering of conditional blocks in DAG preview #88

Open
bentsherman opened this issue Dec 13, 2024 · 1 comment
Open

Improve rendering of conditional blocks in DAG preview #88

bentsherman opened this issue Dec 13, 2024 · 1 comment

Comments

@bentsherman
Copy link
Member

Given the following workflow:

workflow GREET {
    take:
    message
    parallel

    main:
    if( parallel ) {
        sayHello(message).view()
    }
    else {
        println "This message is short so I'll just say it: ${message}"
    }
}

process sayHello {
    input:
    val message

    exec:
    println "This message must be pretty long if you used a process to say it: ${message}"
}

It will produce the following DAG preview:

flowchart TB
    subgraph GREET
    subgraph take
    v1["parallel"]
    v0["message"]
    end
    v2([sayHello])
    v0 --> v2
    end
Loading

The parallel input is not linked to the process because it is not linked to the process inputs, but it is an "input" in a way because it controls whether the process is run.

I think the best way to handle this would be to draw a subgraph for the conditional block (either the entire if/else or separate blocks for if and else) and connect the conditional input to the subgraph.

@bentsherman
Copy link
Member Author

Similarly with this example:

workflow {
  take:
  skip_download

  main:
  if( !skip_download ) {
    ch_samples = // ...
  }
  else {
    ch_samples = Channel.empty()
  }

  emit:
  samples = ch_samples
}

The nodes in the if/else block should be wrapped in a subgraph and skip_download should be linked to that subgraph, to denote that it affects the samples output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant