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

Loops do not repeat execution for leaf nodes (about expected behavior for ForLoop) #10

Open
Shyryp opened this issue Aug 28, 2024 · 2 comments

Comments

@Shyryp
Copy link

Shyryp commented Aug 28, 2024

Expected Behavior
I would expect that the final branches (leaf nodes (nodes without return pins)) in the loop body would also be re-executed with each loop, or I would expect to be able to control this somehow, but I haven't found such functionality.

Actual Behavior
Currently, any leaf nodes in the node tree inside the loop body are not executed in subsequent loops (leaf nodes are executed only once). For example, in the screenshot below, you can see that the preview (on the left) of the very first image created by the loop is displayed, rather than the very last image that is displayed after the loop (on the right). While the loop is running, the image previews are not updated inside the loop body.

Screenshot with workflow with problem:
image

Steps to Reproduce
Here is a simple workflow that makes it easy to reproduce this issue:
Leaf_Node_Problem_Example_Workflow.json

It would be interesting to know why it was decided to make the end nodes run once within a loop, rather than repeatedly - is there any problem with that?

I expect there will be a setting for ForLoop that will allow end nodes to be run in every loop, not just the first one. Or alternative ForLoop nodes that will run end nodes in every loop.

@Shyryp Shyryp changed the title Loops do not repeat execution for leaf nodes (expected behavior for ForLoop) Loops do not repeat execution for leaf nodes (about expected behavior for ForLoop) Aug 28, 2024
@PrometheusDante
Copy link

Yeah, it is a little inconvenient when outputs need to exist and lead someplace in order to execute each loop. I ended up forcing it through node grouping and the use of the impact pack's preview bridge to get an image preview.
It also does not execute multiple times if there is no output after the For Loop Close, which I did not necessarily have. For example I built an auto-captioning workflow based on this and all it does is saved within the loop and nothing really has to come out the other end, so I just put in a dummy string output or something like that to make it execute. 😄

@Shyryp
Copy link
Author

Shyryp commented Aug 30, 2024

Да, это немного неудобно, когда выходы должны существовать и вести куда-то, чтобы выполнить каждый цикл. В итоге я пропустил его через группировку узлов и использование моста предварительного просмотра пакета Impact, чтобы получить предварительный просмотр изображения. Он также не выполняется несколько раз, если нет выходных данных после закрытия цикла For, что у меня не обязательно было. Например, я построил рабочий процесс автозаполнения субтитров на основе этого, и все, что он делает, это сохраняется в цикле, и на самом деле ничего не должно выходить с другого конца, поэтому я просто вставил фиктивный строковый вывод или что-то в этом роде, чтобы он выполнился. 😄

@PrometheusDante Yes, you can add a forced exit for all nodes, but I don't really want to modify nodes or use some third-party custom packages that create such exits for nodes. And I don't want to use a bunch of extra alternative node packages that have exits.

So it would be great to have the ability to run end nodes as an option for ForLoop and While.

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

2 participants