Recursive Loop End woring

I often had the problem whit the Recursive Loop:


I forgot that the Maximal number of iterations is by default at 100 and the last Rows of my Input Tabel got cut of. You dont even get a worning in the knime Console if that happens(Ok, I would ignor it anyway).


And even if i think about the Maximum I have to check it every time I start the Workflow. That has to mutch potential for human error in it for my test.

Just increasing the Maximum does not help against the basic Problem because there is no guarantee that the input Tabel next month is so big that the Maximum is to littel again.

What I need to put an extra Row in the output Tabel that tells me the loop did not run to the End of the Input Tabel.

Is it possible to get the Information that the loop run untli the max interation were hit out of the flow Variablen Port or something like that so I can build myself a worinig Node?

thx
suppe

Hi Suppe,

there is an option "Add iteration Column" with which you can get the total number of iterations.

The MaxIteration is not deactivatable because otherwise you could make endless loops with the node. However, you can set it to maxint (2147483647).

Maybe one last thought if you repeat things per row, this might not be the best loop concept for you?

Best, Iris

I allredy found that option. The thing is that is no new Column in the output if I aktived that option.

hm, you are right, the option only works if you collect data from all iterations instead of only the last one.

Hi,

I think supe is right. The same happened to me: I forgot that the Maximal number of iterations is by default 100. What about inserting an option to get unlimited Maximal number of iterations if checked? 

I don't understand why there should be a mandatory Maximal number of iterations in a loop even if this is very high.

Thank you in advance

I believe that having an endless recursive loop is in general a bad idea for an unconuntable number of reasons... :-)

This said, if you need to set the maximum number of iterations according to some variable property of your data (e.g. number of rows or something else), you can always use Workflow Variables to do so.

Determine the number of iterations you need according to the size of your data --> use it to set a Flow Variable (e.g. use the Table Row to Variable node) --> feed the Flow Variable to the Recursive Loop End node and link it to CFG_MaxNrIterations.

In this way you can have the flexibility you need and still keep the recursion under control.

Hope this helps.

Cheers,
Marco.

1 Like

Thank you Marco. I understand your point. But I'm not proposing to disable the  Maximal number of iterations function.  I just don't understand why If I want to take the risk to have an infinite loop I have to worry about the numbers of loop... And then this number is still restrictive (even if it is high ) and I could potentially need to loop more than 2147483647 times...

Thanks

Cheers