SETL-Framework/setl

Mermaid diagram doesn't work when using a @Delivery Connector

JorisTruong opened this issue · 5 comments

Describe the bug
When trying to generate a Mermaid diagram with a Factory that contains a Connector deliverable, it throws a java.util.NoSuchElementException: head of empty list. This is because HasDiagram trait tries to find the primary constructor of classes, and Connector is abstract.

To Reproduce
You can paste this code in NodeSuite.scala

test("test") {
    val node = Node(
      factoryClass = classOf[Producer1],
      factoryUUID = uuid1,
      stage = 0,
      setters = List(
        testMetadata.copy(argTypes = List(runtime.universe.typeOf[String]), producer = classOf[External])
      ),
      output = FactoryOutput(runtime.universe.typeOf[SparkRepository[String]], List())
    )

    println(node.toDiagram)

    val node2 = Node(
      factoryClass = classOf[Producer1],
      factoryUUID = uuid1,
      stage = 0,
      setters = List(
        testMetadata.copy(argTypes = List(runtime.universe.typeOf[String]), producer = classOf[External])
      ),
      output = FactoryOutput(runtime.universe.typeOf[Connector], List()) // The error is caused by this
    )

    println(node2.toDiagram) // This throws an error
  }

Expected behavior
The Mermaid diagram should be generated even with a Connector deliverable.

Was this fixed? I'm still geeting java.util.NoSuchElementException: head of empty list when using Connector deliverable

this issue has already been fixed (#107). Can you show us how to reproduce this error?

Whenever I have a DataFrame as the output of a Factory, i.e. method get() of Factory returning the resulting DataFrame from process() method, it fails in the payloadField method of FactoryOutput when trying to define value datasetTypeArgFields because args is empty list.

Thank you :) I reproduced the error. It will be fixed in the next snapshot release.

Btw, I recommend using a Dataset as the Factory output unless the factory is in the last stage of your pipeline. Because otherwise you may have to give an unique delivery id to this DataFrame (or specify the producer) if you want it to be delivered by the framework

Nice.. thanks for the tip.. I'll modify it to Dataset.