Wrapped Metanode with Quickforms in inactive branches

I got familiar with Quickforms parametrization abilities of Wrapped Metanodes recently. I really loved it and started to use it whenever appropriate. It was a big improvement for me to shift from the approach of passing flow variables through Metanodes solving difficulties with creating or modifying those variables and I was suffering from many other issues. Well, using Quickforms seemed to me very convenient and elegant. Until…

Until I’ve learnt about an issue that seemed a bit obscuring for me. I collected some facts about Wrapped Metanodes. I’m going to list two of them important for describing a pitfall of Wrapped Metanodes I’ve revealed.

  1. Not even single node in Wrapped Metanode is executed if at least one input port of the Wrapped Metanode locates in an inactive branch. After the Wrapped Metanode itself is executed it is marked green and all the nodes in the Wrapped Metanode are marked white as they locate in inactive branch. All output ports of the Wrapped Metanodes are inactive and crossed out.
    image
    image
    This makes me think that Wrapped Metanode in inactive branch is not executed.

  2. Now something more complex and more confusing. I have a Wrapped Metanode that contains several QuicForm nodes. I put the Wrapped Metanode in a workflow. I configure the Wrapped Metanode referring Flow Variable of the workflow. The Flow Variable I configured my Wrapped Metanode with is not a global flow variable of the workflow but it is an output of a logic that precedes the Wrapped Metanode. The surprising thing is that if the node which creates the flow variable and my Wrapped Metanode appears in an inactive branch an execution of the workflow fails and my Wrapped Metanode is marked red & failed as well as any subsequent nodes of the workflow. A message in console states something like:
    WARN Perform A Logic 7:9 Errors overwriting node settings with flow variables: Unknown variable “column_value”
    QuickForms values configuration. I use Flow Variables preceding nodes created:


    It works in an active branch:
    image
    But it fails in an inactive one:

    image

My conclusion is that if I introduce Wrapped Metanodes in my workflow I’m supposed to always define all the Flow Variables nested Wrapped Metanodes use for their QuickForm values. Otherwise my workflow fails even if those Wrapped Metanodes appear in inactive branches. And if this is true it makes Wrapped Metanodes much less helpful in conditional flows or loops.

Please note I used a simple example workflow to demonstrate what I dealt with. I faced the issue I described in more complicated piece of logic.

2 Likes

I’ve just proved the issue can be partially solved at workflow level adding the Flow Variable the Wrapped Metanode is configured with to the workflow global scope (menu item Workflow Variables). The flow variable is changed properly after flow run through String Input, Table Row to Variable etc. nodes. The flow won’t fail when those nodes appear in an inactive brach since required Flow Variables remain defined. But this obvious over-using the global variables makes things more confusing. Also, this doesn’t solve the issue if it occurs within deeper nesting case, e.g. a workflow contains (in an inactive branch) a Wrapped Metanode that contains another Wrapped Metanode and the first Wrapped Metanode introduces a Flow Variable it uses to configure nested Wrapped Metanode. We’d have to declare appropriate Flow Variables at the workflow level and propagate them to the whole stack of nested Wrapped Metanodes… Nobody is likely to do so I guess.

1 Like

Jan.

You are the best!
I ran into this same issue and would never have discovered the “Workflow Variables” solution without your help.

Thanks.

Dear Jan,
Thank you to point to this issue. Could you please explain a bit more your workaround? What you mean with “adding the Flow Variable … to the workflow global scope”?
Thank you in advance,
Gio

Hi Gio.

Thanks for your reply.

I’d like to explain the term “Workflow variable in global scope”. I distinguished that way those flow variables you can introduce while your workflow is running using, for instance, String Manipulation (Variable) or Table Row to Variable nodes, from those flow variables you create using Workflow Variables menu item from Workflow Explorer View (sorry for inaccuracy, I don’t have KNIME running at the time]. The difference is that those Flow Variables you create via the menu are declared and defined in all parts of the workflow.

Well, for my workaround, it really doesn’t matter which particular way you create the variable. The point is the variable exists outside a Wrapped Metanode that happens to occur in an inactive branch. Of course, the variable must be visible for the Wrapped Metanode.

I consider strange and potentially unsafe about this workaround, that we hide or re-define already existing Flow Variable. And I’m pretty sure KNIME shouldn’t treat Quickform inputs of Wrapped Metanodes in inactive branches the way it actually does.

1 Like

Dear Jan,
I agree with you when you say that “KNIME shouldn’t treat Quickform inputs of Wrapped Metanodes in inactive branches the way it actually does”. I hope they can find a solution soon for this problem.
Best,
Gio

Follow this topic: Wrapped metanodes in inactive branches stop the workflow