Hi,
I've recently encountered a problem where user has been iterating over an Array, using @keep=false, and noticing that files are deleted too early, before the component consuming them is executed. Here's the situation:
arr = ArrayProducingComponent(... , @keep=false)
inputs={}
dataConsumer={}
for el: std.iterArray(arr['arrayPort']) {
inputs[el.key] = INPUT(path=el.file)
dataConsumer[el.key] = SomeComponent( inputs[el.key] )
}
Now, the question is, why do the files in
arr get deleted before
SomeComponent is run?
- Anduril does not see that there is a continuous line of data going through arr -> inputs -> dataConsumer, because INPUT components (despite the name) do NOT have input ports! The flow of output-ports to input-ports is broken by carrying the file location information as a string parameter. If an output port is not connected to an input port, and @keep=false is issued, the files are deleted.
How to fix the script? Skip the INPUT phase!
arr = ArrayProducingComponent(... , @keep=false)
dataConsumer={}
for el: std.iterArray(arr['arrayPort']) {
dataConsumer[el.key] = SomeComponent( arr['arrayPort'][el.key] )
}
Now, the output and input ports are directly connected, and early deletions do not occur.