I’m trying to create a loop around a python script that has pickled object in-out ports.
First try was trying with the following:
By adding a Counting Loop Start that has 3 pickled objects ports, but it seems to fail where the iteration is equal to 1, where it is taking the same reference of the initial object.
The python script “Process Execution” is basically responsible to modify these objects within the loop.
I looked further in the Forum on how to modify objects but could not find a specific topic regarding objects, but found that tables can be modified via the Recursive Loop.
However, it seems that the Recursive Loop node ports does not have any object type but tables.
Which boils down to my questions:
- is it even possible to modify pickled
objects within a loop? if so, how can this be accomplished in KNIME
- End Loop does not have an object port, is there any specific endloop for python objects, I would assume since it has a start loop of type Python Path Trough (any object type)
- Recursive Loops would accomplish modifying incoming data, does it work with pickled object? or is there any other way to handle it.
Attached a Simple version of the Workflow:
CountingLoopBatch.knwf (17.0 KB)
Regarding using Recursive Loop, you can use the Model To Cell and Cell to Model nodes to pass the pickled objects into the recursive loop.
I guess it should be constructed as the following, though I get a warning on the other side:
I’m not sure since I can not see how you have closed your loop but make sure to pass the model cell with the same column name at the loop end so in the next iterations, the Cell To Model can convert it to a model again.
Could you share an example workflow with some sample data?
I just added the Cell-to-Model Mode-to-Cell. it does not reach the Recursive Loop End as it breaks before on the Cell-to-Model with the error mentioned.
This is the shared example:
Cell_to_Model.knwf (27.8 KB)
Thank you for providing the example workflow.
I could configure and execute the Cell To Model nodes without any issues. I think you didn’t configured them. In this case, since there is only one possible option, you just need to open the configuration dialog and click on OK. Then the nodes will be in the configured state and ready to execute.
But, as I see your loop end, you need to add another “Recursion” port since you have two ports at start. So the top input port of the loop end is the “Collector” and the other two ports would be for recursion. Be aware that you need to provide model cells to the recursion ports since these are fed to the next iterations of the loop.
Thanks! yeah that did the trick!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.