Node to stop / quit running dynamo graph

dynamo

#1

I´m looking for a node/python script, that stops the complete running graph, if it gets a TRUE value.

After creating bigger and more complexe dynamo graphs lately, I started creating in-dynamo error testing measures to prevent running with mistakes like wrong/null inputs or python scripts giving traceback.

Currently I´m using Passthrough nodes to stop the TRUE value for RunIt inputs of nodes by the event of error, but that´s not a good solution, as a lot of nodes don´t have a RunIt function.
So even if the error is detected and the Passthrough closes, there are still a lot of nodes working and paths completing until the graph finally stops.

This is a big waste of time, as a run with an error takes as long as the error-free run but has not the wanted results.

My goal is, to have a node, that instantly stops the whole dynamo graph (every node+function, even if they are not in the same path) as soon as it gets the TRUE value.

Hope I explained it understandable. :slight_smile:


#2

Have a look at using the OOTB “ScopeIf” node :slight_smile:

You could be inspired by this post if you’d like:


#3

From what I understand, Dynamo doesn’t (necessarily) execute serially, making flow control largely impossible. I think the ScopeIf is perhaps an exception and intended only for custom nodes?
The only other effective means of flow control is Imperative blocks in CBNs because they force linear execution, though only within the block itself.
I believe the developers are looking at other flow control possibilities but as yet there’s no other way to stop execution in its tracks…


#4

I’d temper that by stating “without some effort wiring some degree of planning input control to each branch of the graph.”

This node definitely works better with custom nodes than in most graphs.

This is only partially true…

A custom node with content grouped inside of it will not process much of anything if you properly wire a Boolean to control the run state. Most libraries are chalk full of this type of control.


#5

I just made a promising test based on @Jonathan.Olesen idea.


#6

Wow, didn’t even knew that node existed…
This may save me some valuable time on calculations ! Thanks @Jonathan.Olesen !


#7

Just to set this clear, apparently there is no easy way, like e.g.
"create a Python script node and type ‘dynamo.quitrun’ blablabla (or something like that) "
to stop the whole run instantly. Correct me if I`m wrong.

So what would be a good solution to stop the graph from running the remaining nodes? (After error detection)

As far as I know Boolean Switches, if, passthroughs, etc. are not stoping the connected paths. They are just sending null data, which still makes the following nodes start operating.

And what´s that with this ScopeIf node? How does it work and how is it supposed to help me with my problem?
I tried to rebuild the test from @M.Perez , but i got a cyclic dependencies error on my nodes.

Thy for the quick answers, btw. :smile:


#8

From what I got, the ScopeIf node will execute first, evaluate the boolean, and then compute all the nodes that are connected to the corresponding value. Then the result will be stocked in the result* output of the ScopeIf node. That is why, in @M.Perez graph, the watch node is outputing null.


#9

That is correct @mellouze, to my knowledge that is by far your best bet, next to converting everything into a python/c#/designscript node and suppress stuff in there.


#10

It also happened to me that the List.Create node gives me an error, but it is probably because your are preventing this branch to execute.

It is exactly like @mellouze descrieved.

If you change the boolean, it will resolve properly


#11

Correct, but sending null or an empty list to most nodes instantly returns null or an empty list… if your graph doesn’t execute in an instant with all null inputs across the board than it would likely never finish with a reasonably sized dataset.