1 year ago
#276448
ArvN
Best way to ensure something happens more than once in an overall sequence, but only once for each subsequence
I have a scenario where a starting action branches out and triggers multiple actions. such as :
A -> B -> D -> F
-> E -> H
-> C -> E -> H
-> F -> G
B and C both started from A, and "DEEF" started from B & C, and so on.
Today, I only allow "E" to run once in the overall sequence. However there is now a requirement to allow "E" to run more than once in the overall sequence, but only for unique originators (so as to avoid any looping). I.E. "E" (or "F" or "G") in above example, can run once in the sequence C -> E -> H and once in A -> B -> E --> H but never A -> B -> E -> H -> E. E can also only always emit H, B can only emit D and E etc. so that set is immutable.
Hopefully I was able to explain the problem.
My initial thought is to have each action output a nonce value - and then store if an action has already run for a nonce value (originator) then it can't run again for that same originator.
In the above example A would create a nonce value "foobar". B and C would not have run for the nonce "foobar" in the flow yet, so they would run the first time.
B would output nonce "boofar" and C would output nonce "oofbar". The next set of actions would check, if they have run for either of these nonces - "E" in particular would now be able to run for each nonce, instead of running only once for the sequence as in the current single per sequence lookup.
I think this might work, but wondering if I'm missing anything. Would appreciate more interesting thoughts.
EDIT: Saw Thomas's comment below - nonce alone would not help me solve the loop issue. I might consider adding a nonce vector that keeps adding ie. foobar.boofar.oofbar and then check that a module ran once for each nonce vector?
algorithm
graph
sequence
nonce
0 Answers
Your Answer