We had a question pop up in our design review output the evaluation order of Data Input Save Input and Data Outputs. I know there is no guarantee on the order of Data Output execution, but I was wondering if there is a guarantee that Data Input Save Into's are evaluated first.
For example: Say before a script task, pv!index=0
And has the Data Inputs configured as below
And Data Outputs configured as
Would the order evaluation be:
So after execution: pv!index is guaranteed to be 2
Or could it potentially be:
So after execution: pv!index could be 1 or 2 depending on the order of the Save Into's and Outputs were evaluated
A member of my team had heard that Save Into's and Outputs are evaluated together.
Discussion posts and replies are publicly visible
As far as I've been able to put together:
I do NOT believe it's accurate to say that inputs and outputs are evaluated all together. Though in a script task or other node type with no significant wait before start and end, you should assume that the outputs will be evaluated almost instantly after the inputs are evaluated.
In your example there's a bit of a race condition, since pv!index is receiving outputs both from the input and from the output. I'd need to test it out a bit to see, but I suspect that the rule output will override/overwrite anything saved from the rule input.
Hi Mike,
Thanks for the response. That's exactly what I'm trying to determine. Is there a race condition or not on pv!index when using Inputs Save Into and Outputs?
If pv!index is guaranteed to be committed from Save Into before evaluating outputs, then there's not. However, if this is not guaranteed the case, then there is.
In my experience, you should be saving into pv!index in only one of those two places.
My intuition is that the execution order is something like this:
however it's hard to prove this one way or the other, and I don't believe there is any guarantee either way. Therefore you should avoid the race condition and if you're saving into it from the node output, then again I recommend you save into it ONLY from the node output.